<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <!-- 使用不同智能机的宽度 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="renderer" content="webkit">
    <title>MissQ校花</title>
    <link rel="stylesheet" href="css/base.css"/>
    <link rel="stylesheet" href="css/drawmoney.css"/>
    <script src="js/jquery-1.12.3.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script src="js/md5-min.js"></script>
    <script>
//        wx.config({
//            debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
//            appId: 'gh_679c33bfb1db', // 必填，公众号的唯一标识
//            timestamp:'11111111', // 必填，生成签名的时间戳
//            nonceStr: '123456', // 必填，生成签名的随机串
//            signature: '11111111',// 必填，签名，见附录1
//            jsApiList: ['hideOptionMenu'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
//        });
        function onBridgeReady(){
            WeixinJSBridge.call('hideOptionMenu');
        }

        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        }else{
            onBridgeReady();
        }

        ;(function(win, doc){
            function change(){
                doc.documentElement.style.fontSize=20*doc.documentElement.clientWidth/320+'px';
            }

            if(doc.documentElement.clientWidth>640){
                doc.documentElement.style.fontSize=20*640/320+'px';
            }else{
                change();
            }
            win.addEventListener('resize', change, false);
        })(window, document);

        function sendcode(obj){
            var countdown=60;
            var str=$('.drawMOney-phone-text').val();
            var nowStr=str.replace(/\s+/g,'');//去掉所有空格
            $.ajax({
                url:'http://app.missquq.com/h5/rebBack/sms_get',
                data: {
                    mobile:nowStr
                },
                jsonp: 'callback',
                dataType: 'jsonp'
            });

            settime();
            function settime() {
                if (countdown == 0) {
                    obj.removeAttribute("disabled");
                    obj.value="获取验证码";
                    countdown = 60;
                    return;
                } else {
                    obj.setAttribute("disabled", true);
                    obj.value="重新获取(" + countdown + ")";
                    countdown--;
                }
                setTimeout(function() {
                            settime() }
                        ,1000)
            }
        }
        //倒计时

        $(function(){
            $('.drawMOney-phone-text').focus();
            var reg =/^1[34578]\d{9}$/;
            $('.bg').css('height',$(document).height());
            $('.popupBTN').on('click',function(){
                $('.cover,.drawmoney-popup').css('display','none');
            });
            $('.drawmoney-enter').on('click',function(){
                //验证手机号是否合规

                var phonestr = $('.drawMOney-phone-text').val();
                var passwordstr=hex_md5(hex_md5($('.drawMOney-password-text').val()));
                var codestr=$('.drawMOney-verification-text').val();
                if(!reg.test(phonestr)){
                    $('.popupTextU').text('对不起，您输入了外星人号码');
                    $('.popupTextD').text('请重新输入手机号码');
                    $('.cover,.drawmoney-popup').css('display','block');
                }else{
                    $.each($('.drawMOney-main input'),function(i){
                        if($('.drawMOney-main input').eq(i).val()==''){
                            $('.popupTextU').text('对不起，您有未填项');
                            $('.popupTextD').text('请重新输入');
                            $('.cover,.drawmoney-popup').css('display','block');
                            return false;
                        }
                    });
                    $.ajax({
                        url:'http://app.missquq.com/h5/rebBack/blance',
                        data:{
                            mobile:phonestr,
                            password:passwordstr,
                            code:codestr
                        },
                        jsonp: 'callback',
                        dataType: 'jsonp',
                        success: function(json) {
                            if(json.state && json.state=='false'){
                                $('.popupTextU').text('手机号或密码输入错误');
                                $('.popupTextD').text('请重新输入');
                                $('.cover,.drawmoney-popup').css('display','block');
                            }else if(json.state && json.state=='code_false'){
                                $('.popupTextU').text('验证码错误');
                                $('.popupTextD').text('请重新输入');
                                $('.cover,.drawmoney-popup').css('display','block');
                            }else if(json.userId){
                                $('.popupTextU').text('恭喜您');
                                $('.popupTextD').text('即将进入个人提现主页');
                                $('.cover,.drawmoney-popup2').css('display','block');
//                                jump=json.userId;
                                $('.popupA').attr('href','http://app.missquq.com/h5/rebBack/jump?userId='+json.userId);
                            }
                        }
                    });
                }


            });

        });
    </script>
</head>
<body>
<div class="w640 mainbox">
    <img src="img/drawmoney/bg.jpg"  alt="" class="bg"/>
    <div class="drawMOney-title">
        <p class="d-title-up">提现身份验证</p>
        <p class="d-title-down">请输入手机号码和登录密码验证身份</p>
    </div>
    <div class="drawMOney-main">
        <input type="text" class="drawMOney-phone-text" required="required" placeholder="请输入手机号" onpaste="return false;"/>
        <input type="password" class="drawMOney-password-text" required="required" placeholder="请输入密码" onpaste="return false;"/>
        <input type="text" class="drawMOney-verification-text" required="required" placeholder="请输入验证码" onpaste="return false;"/>
        <img src="img/drawmoney/phone.png" class="drawMOney-phone">
        <img src="img/drawmoney/password.png" class="drawMOney-password">
        <img src="img/drawmoney/verification.png" class="drawMOney-verification">
        <input type="button"  class="drawMOney-verificationBTN" value="获取验证码" onclick="sendcode(this)"/>
    </div>
    <div class="drawmoney-enter">进入</div>
    <div class="cover"></div>
    <div class="drawmoney-popup">
        <img src="img/drawmoney/popup.jpg" alt="" class="popupBG"/>
        <img src="img/drawmoney/pic-mistake.png" alt="" class="popupIcon"/>
        <p class="popupTextU"></p>
        <p class="popupTextD"></p>
        <button class="popupBTN">确定</button>
        <div class="line"></div>
    </div>
    <div class="drawmoney-popup2">
        <img src="img/drawmoney/popup.jpg" alt="" class="popupBG"/>
        <img src="img/drawmoney/pic-succeed.png" alt="" class="popupIcon"/>
        <p class="popupTextU"></p>
        <p class="popupTextD"></p>
        <a href="javascript:;" class="popupA">快速进入</a>
        <div class="line"></div>
    </div>
</div>
</body>
</html>